//个人信息
import React, { Component } from 'react';
import {
    View,
} from 'react-native';



var Dimensions = require('Dimensions');
var width = Dimensions.get('window').width;
var height = Dimensions.get('window').height;
import Inf_body from './inf_body';

import { MemberInfoAction, updateMemberInfoAction } from '../../../actions/systemAction';      //加载action
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';

class Information extends Component {
    // 初始化模拟数据
    constructor(props) {            //构造器只执行一次
        super(props);
    };

    //加载后渲染页面
    componentDidMount() {
        this.props.actions.MemberInfoAction(); //初始化查询
    }

    render() {
        const { member } = this.props.Member.data;
        return (
            <View style={{ backgroundColor: '#ffffff', flex: 1 }}>
                {/* <Inf_top member={member} navigation={this.props.navigation} /> */}
                <Inf_body actions={this.props.actions} member={member} navigation={this.props.navigation} />
            </View>
        )
    }
}

//组合action
var actions = {
    MemberInfoAction,
    updateMemberInfoAction,
}

//连接state到props
const mapStateToProps = state => {
    return {
        Member: state.MemberInfoReducer,
    }
}

//连接action
const mapDispatchToProps = (dispatch) => {
    return {
        actions: bindActionCreators(actions, dispatch)
    }
}

//导出组合好的组件(组合后状态改变重新渲染组合组件的页面)
export default connect(
    mapStateToProps, mapDispatchToProps
)(Information);